package com.example.myandroidapp;


import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class ThirdActivity extends TabActivity
{

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabs_main);
        
        initTabs(savedInstanceState);
        
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu)
    {
        getMenuInflater().inflate(R.menu.activity_third, menu);
        return true;
    }
    
    private void initTabs(Bundle savedInstanceState)
    {
        TabHost tabHost = getTabHost();

        // Tab for Photos
        TabSpec discoverspec = tabHost.newTabSpec("Photos");
        // setting Title and Icon for the Tab
        discoverspec.setIndicator("Photos", getResources().getDrawable(R.drawable.ico_news));
        Intent discoverIntent = new Intent(this, TabOneActivity.class);
        discoverspec.setContent(discoverIntent);

        // Tab for Songs
        TabSpec searchspec = tabHost.newTabSpec("Songs");
        searchspec.setIndicator("Songs", getResources().getDrawable(R.drawable.ico_more));
        Intent searchIntent = new Intent(this, TabTwoActivity.class);
        searchspec.setContent(searchIntent);

        // Tab for Videos
        TabSpec gowildspec = tabHost.newTabSpec("Videos");
        gowildspec.setIndicator("Videos", getResources().getDrawable(R.drawable.ico_video));
        Intent gowildIntent = new Intent(this, TabThreeActivity.class);
        gowildspec.setContent(gowildIntent);


        // Adding all TabSpec to TabHost
        tabHost.addTab(discoverspec); // Adding photos tab
        tabHost.addTab(searchspec); // Adding songs tab
        tabHost.addTab(gowildspec); // Adding videos tab
    }
}
